import VAxios from './VAxios'
import { defaultOptions } from './config'
const server = (url, config) => {
  const params = {}
  for (const key in defaultOptions) {
    if (Object.hasOwnProperty.call(config, key)) {
      params[key] = config[key]
    } else {
      params[key] = defaultOptions[key]
    }
  }
  params.apiUrl = url
  return new VAxios(params)
}

export default server
